<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
global $data, $admin;

class Xpanel extends CI_Controller {

    public function __construct() {
        parent::__construct();
        global $admin, $data;
        # cargamos variables
        $admin = $this->session->userdata('admin');
//        $data['place'] = 'xpanel';
        $admin['place'] = 'xpanel';
        # verifica si pasó por sushitto
        if ($admin['ta_tipo_administrativo_id'] != 1) {
            redirect('sushitto');
        }
        $this->carga_estadisticas();
        $this->output->enable_profiler(FALSE);
    }

    public function index() {
        global $data, $admin;

        $this->load->view('template/header', $admin);
        $this->load->view('template/open_content_container');
        $this->load->view('menu/menu_supervisor', $data);
        $this->load->view('panel/cpanel_main');
        $this->load->view('template/close_content_container');
        $this->load->view('template/footer');
    }

    public function logOut() {
        //termina session de ususario
        $this->session->sess_destroy();
        redirect(base_url());
    }

    public function carga_estadisticas() {
        global $data, $admin;
        $data['tPreg'] = $this->mining_model->total_preguntas();
        $data['tCuest'] = $this->mining_model->total_cuestionarios();
    }

}
